package com.example.util;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;


public class TClient {
	public static String commMethod(String info){
		String result = "";
		SoapObject soapObject = new SoapObject(Const.NAMESPACE,Const.GETDRIVERINFO);
		soapObject.addProperty("barcode",info);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
		envelope.dotNet = false;
		envelope.setOutputSoapObject(soapObject);
		HttpTransportSE ht = new HttpTransportSE(Const.IDCARDURL);
		ht.debug = true;
		try {
			ht.call(Const.NAMESPACE, envelope);
			Object o = envelope.getResponse();
			result = o.toString() ;
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("1111111111"+result);
		return result;
	}
	public static String saveStopCarVoilationInfo(String requestXml){
		String result = "";
		SoapObject soapObject = new SoapObject(Const.NAMESPACE,Const.saveto);
		soapObject.addProperty("requestXml",requestXml);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
		envelope.dotNet = false;
		envelope.setOutputSoapObject(soapObject);
		HttpTransportSE ht = new HttpTransportSE(Const.IDCARDURL);
		ht.debug = true;
		try {
			ht.call(Const.NAMESPACE, envelope);
			Object o = envelope.getResponse();
			result = o.toString() ;
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("1111111111"+result);
		return result;
	}
	public static String saveStopCarPicInfo(String imgStr,String create_time,String carNo,String seq){
		String result = "";
		SoapObject soapObject = new SoapObject(Const.NAMESPACE,Const.SAVEIMAGE);
		soapObject.addProperty("in0",imgStr);
		soapObject.addProperty("in1",create_time);
		soapObject.addProperty("in2",carNo);
		soapObject.addProperty("in3",seq);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
		envelope.dotNet = false;
		envelope.setOutputSoapObject(soapObject);
		HttpTransportSE ht = new HttpTransportSE(Const.IDCARDURL);
		ht.debug = true;
		try {
			ht.call(Const.NAMESPACE, envelope);
			Object o = envelope.getResponse();
			result = o.toString() ;
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println(""+result);
		return result;
	}
	public static String scanVoilationInfoByCar(String imgStr,String nulStr){
		String result = "";
		SoapObject soapObject = new SoapObject(Const.NAMESPACE,Const.SACNLISTBYCAR);
		soapObject.addProperty("in0",imgStr);
		soapObject.addProperty("in1",nulStr);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
		envelope.dotNet = false;
		envelope.setOutputSoapObject(soapObject);
		HttpTransportSE ht = new HttpTransportSE(Const.IDCARDURL);
		ht.debug = true;
		try {
			ht.call(Const.NAMESPACE, envelope);
			Object o = envelope.getResponse();
			result = o.toString() ;
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("1111111111"+result);
		return result;
	}
	public static String loginCheck(String userName,String password){
		String result = "";
		SoapObject soapObject = new SoapObject(Const.NAMESPACE,Const.LOGINCHECK);
		soapObject.addProperty("in0",userName);
		soapObject.addProperty("in1",password);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
		envelope.dotNet = false;
		envelope.setOutputSoapObject(soapObject);
		HttpTransportSE ht = new HttpTransportSE(Const.IDCARDURL);
		ht.debug = true;
		try {
			ht.call(Const.NAMESPACE, envelope);
			Object o = envelope.getResponse();
			result = o.toString() ;
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("1111111111"+result);
		return result;
	}
	public static String syncEMP(String info,String id ){
		String result = "";
		SoapObject soapObject = new SoapObject(Const.NAMESPACE,Const.saveto);
		soapObject.addProperty("info",info);
		soapObject.addProperty("id",id);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
		envelope.dotNet = false;
		envelope.setOutputSoapObject(soapObject);
		HttpTransportSE ht = new HttpTransportSE(Const.IDCARDURL);
		ht.debug = true;
		try {
			ht.call(Const.NAMESPACE, envelope);
			Object o = envelope.getResponse();
			result = o.toString() ;
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("::::"+result);
		return result;
	}
	public static String syncRENT(String info,String id ){
		String result = "";
		SoapObject soapObject = new SoapObject(Const.NAMESPACE,Const.SYNCRENT);
		soapObject.addProperty("info",info);
		soapObject.addProperty("id",id);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
		envelope.dotNet = false;
		envelope.setOutputSoapObject(soapObject);
		HttpTransportSE ht = new HttpTransportSE(Const.IDCARDURL);
		ht.debug = true;
		try {
			ht.call(Const.NAMESPACE, envelope);
			Object o = envelope.getResponse();
			result = o.toString() ;
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("::::"+result);
		return result;
	}
}
